import {request} from '../uitls/request'
//用户验证
export function validUser() {
    return request({
        url: '/xiaomi/v2/ms/user/info',
        method: 'GET',
        isToken: false,
    })
}
//登录
export function Login(data){
    return request({
        url:'/xiaomi/v2/ms/user/login',
        method:'POST',
        data
    })
}
//注册
export function regist(data){
    return request({
        url:'/xiaomi/v2/ms/user/register',
        method:'POST',
        data:data
    })
}
//轮播查询
export function getRotation(params){
    return request({
        url:'/xiaomi/v2/carousel',
        method:'get',
        params
    })  
}
//查询当前用户购物车
export function shoppingCart(params){
    return request({
        url:'/xiaomi/v2/shoppingCart',
        method:'get',
        params
    })  
}
//添加购物车商品
export function addshoppingCart(data){
    return request({
        url:'/xiaomi/v2/shoppingCart',
        method:'POST',
        data:data
        
    })
}
//查询当前用户购物车商品数量
export function productcount(params){
    return request({
        url:'/xiaomi/v2/shoppingCart/product/count',
        method:'get',
        params
    })  
}
//修改购物车商品数量
export function productnum(data){
    return request({
        url:'/xiaomi/v2/shoppingCart/product/num',
        method:'put',
        data
    })  
}
//删除购物车商品
export function delshoppingCart(data){
    return request({
        url:'/xiaomi/v2/shoppingCart/' + data,
        method:'DELETE',
    })  
}
//查询订单
export function orders(params){
    return request({
        url:'/xiaomi/v2/orders',
        method:'get',
        params
    })  
}
//生成订单
export function addorders(data){
    return request({
        url:'/xiaomi/v2/orders/' + data,
        method:'POST',
    })
}
//获取个人信息
export function getInfo(params){
    return request({
        url:'/xiaomi/v2/ms/user/info',
        method:'get',
        params
    })  
}
//查询当前用户收藏商品信息
export function getcollect(params){
    return request({
        url:'/xiaomi/v2/collect',
        method:'get',
        params
    })  
}
//收藏-取消收藏
export function collect(data){
    return request({
        url:'/xiaomi/v2/collect/' + data,
        method:'POST',
    })
}
//查询商品分类列表
export function category(){
    return request({
        url:'/xiaomi/v2/category',
        method:'get',
        
    })  
}
//查询商品列表
export function product(params){
    return request({
        url:'/xiaomi/v2/product',
        method:'get',
        params
    })  
}
//首页热门商品列表
export function hot(){
    return request({
        url:'/xiaomi/v2/product/hot',
        method:'get',
    })  
}
//查询商品详情
export function detail(params){
    return request({
        url:'/xiaomi/v2/product/'+ params,
        method:'get',
    })  
}  